<template>
  <div class="image-container">
    <img
      v-if="src"
      :src="src"
      :alt="altText"
      :style="`width: ${width}; height: ${height}; border-radius: ${borderRadius};`"
    />

    <img
      v-else
      src="@/assets/images/暂无图片.png"
      :alt="altText"
      :style="`width: ${width}; height: ${height}; border-radius: ${borderRadius};`"
    />
  </div>
</template>

<script setup>
defineProps({
  src: {
    type: String,
    required: true,
  },
  altText: {
    type: String,
    default: "",
  },
  width: {
    type: String,
    default: "100px",
  },
  height: {
    type: String,
    default: "100px",
  },
  borderRadius: {
    type: String,
    default: "6px",
  },
});
</script>

<style scoped>
.image-container {
  display: inline-block;
}
</style>
